<?php
if (!defined('IN_XLP')) {
    exit('Access Denied');
}
?>
<!--主体 开始-->
    <div class="row" style="width:500px">
      <div class="col-sm-12">
        <section class="panel">
          <div class="panel-body">
            <form class="form-horizontal" method="post" id="form1">
                <div class="form-group"> 
                  <label class="col-sm-3 control-label">标签名称</label> 
                  <div class="col-sm-6"> 
                   <input type="text" name="tag_title" id="tag_title" placeholder="" value="<?php echo $rs['tag_title'];?>" class="form-control"/>
                   <span class="help-block">请输入标签名称</span>
                  </div>
             	</div>
                <div class="form-group"> 
                  <label class="col-sm-3 control-label">排序值</label> 
                  <div class="col-sm-6"> 
                   <input type="text" name="sort" id="sort" placeholder="" style="width:60px" value="<?php echo $rs['sort'];?>" class="form-control"/>
                   <span class="help-block">请输入排序值，0-99，越大越靠前</span>
                  </div>
             	</div>
              <div class="form-group">
                  <div class="col-sm-9 col-lg-offset-1">
                    <div class="col-sm-4"><button type="submit" id="sub-ok" class="btn btn-primary">保存</button></div>
                    <div class="col-md-offset-2"><button type="button" id="close-btn" class="btn btn-white">关闭</button></div>
                  </div>
               </div>
               <input name="id" type="hidden" value="<?php echo $rs['tag_id'];?>" />
            </form>
          </div>
        </section>
      </div>
    </div>
<!--主体 结束-->
<script>
$(function(){
	$("#close-btn").click(function(){
		$(document).trigger('close.facebox')
	})
	$('#form1').submit(function(){
		if (!$('#tag_title').val()){
			Msg.error('请输入标签名称');
			resetSubmit("#sub-ok",'保存');
			return false;
		}
		Msg.loading();
		  $.post('<?php echo U('nearby/tags_save');?>',$(this).serialize(),function(result){
			  Msg.hide();
			  resetSubmit("#sub-ok",'保存');
			  if (result.status==1){
				Msg.ok('编辑成功',function(){
					document.location.reload();	
				},1000);
			}else{
				Msg.error(result.info);
			}
		  },'json');
		  return false;
	})	
})
</script>
